

    const jwt = require('jsonwebtoken')
    const userDao = require('../dao/loginDao')

    module.exports = {

        jwtCheck: async (ctx, next) => {
            let token = ctx.request.body.token
            jwt.verify(token, '15914035518', (err, decoded) => {
                if(err) {
                    ctx.body = {
                        code: -1,
                        msg: '登陆失败',
                    }
                }
                else {
                    decoded = {...decoded, password: ''}
                    ctx.body = {
                        code: 0,
                        msg: '登录成功',
                        res: decoded
                    }
                }
            })

        }

    }